#ifndef MLOADER_MODEL
#define MLOADER_MODEL

#include "Common.h"
#include "Mesh.hpp"
#include "Material.hpp"
#include "Animation.hpp"

namespace MLoader
{
    struct Node
    {
        std::string Name;
        
        Node* Parent;               // NULL if this node is the root node
        gm::Mat4 Transform;         // Relative to the node's parent
        std::vector<Mesh*> Meshes;  // Coordinate based on Node
        std::vector<Node*> Children;
        
        Node* Find(const std::string& name)
        {
            if (name == this->Name) return this;
            
            for (Node* node : Children) {
                Node* n = node->Find(name);
                if (n) return n;
            }
            
            return nullptr;
        }
    };

    class Model
    {
    public:
        std::string Name;

        Node* Skeleton;            // Multiple nodes can refer to the same mesh
        std::vector<Mesh> Meshes;  // All Mesh is store here for Nodes
        std::vector<Material> Materials;
        std::vector<Animation> Animations;
    };
}


#endif // MLOADER_MODEL
